<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>其它原型语法</title>
</head>
<body>
  <script>
    function Person() {}

    Person.prototype = {
      name: "Nicholas",
      age: 29,
      job: "Sofeware Engineer",
      sayName() {
        console.log(this.name);
      }
    };

    // 恢复 constructor 属性
    Object.defineProperty(Person.prototype, "constructor", {
      enumerable: false,
      value: Person
    });
  </script>
</body>
</html>